//
//  Networking.h
//  宏铭科技
//
//  Created by 宏铭科技 on 16/6/30.
//  Copyright © 2016年 程超. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFHTTPSessionManager.h>
typedef void(^SuccessBlock)(id responseObject);
typedef void(^FailureBlock)(NSError *error);
typedef void(^ProgressBlock)(CGFloat progress);
typedef void(^NetWorkingManagerRestTaskCompletion)(id retObject, NSError * error);
@interface CCNetworking : NSObject


/**
 POST 网络请求方法
 
 @param UrlStr  业务接口地址
 @param params  传递的参数对象
 @param success 请求成功后的回调
 @param failure 请求失败后的回调
 @return        NSURLSessionTask实例对象
 */
+ (NSURLSessionTask *)postWithUrl:(NSString *)UrlStr requestParams:(NSDictionary *)params successHander:(SuccessBlock)success failureHander:(FailureBlock)failure;


/**
 GET 网络请求方法
 
 @param UrlStr  业务接口地址
 @param params  传递的参数对象
 @param success 请求成功后的回调
 @param failure 请求失败后的回调
 @return        NSURLSessionTask实例对象
 */
+ (NSURLSessionTask *)getWithUrl:(NSString *)UrlStr requestParams:(NSDictionary *)params successHander:(SuccessBlock)success failureHander:(FailureBlock)failure;



//图片上传
+ (AFHTTPSessionManager *)postWithDataUrl:(NSString *)url requestParams:(NSDictionary *)params image:(UIImage *)image imageArray:(NSArray *)imageArray Completion:(NetWorkingManagerRestTaskCompletion)completion;



/**
 数据流上传

 @param parameter 参数
 @param success 成功
 @param failure 失败
 */
+ (void)uploadWithParameter:(NSDictionary *)parameter
                           data:(NSData *)data
                       progress:(ProgressBlock)progressBlock
                  successHander:(SuccessBlock)success
                  failureHander:(FailureBlock)failure;


@end
